var hammingWeight = function (n) {
  let time = 0
  n = n.toString(2)
  for (let i = 0; i < n.length; i++) {
    if (n[i] == 1) {
      console.log('i', i)
      time++
    }
  }
  return time
};

console.log(hammingWeight(11))